import { BasicColumn } from '/src/components/Table';
import { FormSchema } from '/src/components/Table';
import { rules} from '/src/utils/helper/validator';
import { render } from '/src/utils/common/renderUtils';
import { getWeekMonthQuarterYear } from '/src/utils';
import { custom } from 'vue-types';
import { multiSelect } from 'dingtalk-jsapi/api/apiObj';
import { t } from '/@/hooks/web/useI18n';

//列表数据
export const columns: BasicColumn[] = [
  {
    title: '景点名称',
    align: 'center',
    dataIndex: 'attractionName',
  },
  {
    title: '分类',
    align: 'center',
    dataIndex: 'attractionTheme_dictText',
  },
  {
    title: '描述',
    align: 'center',
    dataIndex: 'attractionDescription',
  },
  {
    title: '建议游览时长（分钟）',
    align: 'center',
    dataIndex: 'attractionRecommendedDuration',
  },
  {
    title: '最大承载量',
    align: 'center',
    dataIndex: 'attractionCapacity',
  },
  // 0否 1是  （推荐、热门景点）
  {
    title: '推荐景点',
    align: 'center',
    dataIndex: 'isFeatured_dictText',
    customRender: ({ text }) => {
      return render.renderDict(text, 'yn');
    },
  },
  {
    title: '热度',
    align: 'center',
    dataIndex: 'attractionHeat',
  },
  // 0-开放 1-维修 2-临时关闭
  {
    title: '状态',
    align: 'center',
    dataIndex: 'attractionStatus',
    customRender: ({ text }) => {
      return render.renderDict(text, 'attraction_status');
    },
  },
  {
    title: '营业时间',
    align: 'center',
    dataIndex: 'businessHour',
  },
  // {
  //   title: '国',
  //   align: 'center',
  //   dataIndex: 'attractionCountry',
  // },
  // {
  //   title: '省份',
  //   align: 'center',
  //   dataIndex: 'attractionProvince',
  // },
  // {
  //   title: '城市',
  //   align: 'center',
  //   dataIndex: 'attractionCity',
  // },
  // {
  //   title: '县/市/区',
  //   align: 'center',
  //   dataIndex: 'attractionDistrict',
  // },
  // {
  //   title: '区域编码',
  //   align: 'center',
  //   dataIndex: 'areaCode',
  // },
  {
    title: '景区地址',
    align: 'center',
    dataIndex: 'attractionAddress',
    width: 400,
  },
  // {
  //   title: '经度',
  //   align: 'center',
  //   dataIndex: 'longitude',
  // },
  // {
  //   title: '纬度',
  //   align: 'center',
  //   dataIndex: 'latitude',
  // },
  {
    title: '联系人名称',
    align: 'center',
    dataIndex: 'contactName',
  },
  {
    title: '联系电话',
    align: 'center',
    dataIndex: 'contactPhone',
  },
  {
    title: '官网网站',
    align: 'center',
    dataIndex: 'website',
  },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: '景点名称',
    field: 'attractionName',
    component: 'JInput',
    colProps: { span: 6 },
  },
  // 0否 1是
  {
    label: '热门景点',
    field: 'isFeatured',
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: 'yn',
    },
    colProps: { span: 6 },
  },
  {
    field: 'attractionTheme',
    component: 'Input',
    label: '景点分类',
    slot: 'category'
  }
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '景点名称',
    field: 'attractionName',
    component: 'Input',
  },
  {
    label: '描述',
    field: 'attractionDescription',
    component: 'Input',
  },
  //（单位:分钟）
  {
    label: '建议游览时长',
    field: 'attractionRecommendedDuration',
    component: 'InputNumber',
  },
  {
    label: '最大承载量',
    field: 'attractionCapacity',
    component: 'InputNumber',
  },
  // 0否 1是
  {
    label: '推荐景点',
    field: 'isFeatured',
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: 'yn',
    },
  },
  {
    label: '热度',
    field: 'attractionHeat',
    component: 'InputNumber',
  },
  // 0-开放 1-维修 2-临时关闭
  {
    label: '状态',
    field: 'attractionStatus',
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: 'attraction_status',
    },
  },
  {
    label: '营业时间',
    field: 'businessHour',
    component: 'Input',
  },
  {
    label: '国',
    field: 'attractionCountry',
    component: 'Input',
  },
  {
    label: '省份',
    field: 'attractionProvince',
    component: 'Input',
  },
  {
    label: '城市',
    field: 'attractionCity',
    component: 'Input',
  },
  {
    label: '县/市/区',
    field: 'attractionDistrict',
    component: 'JAreaLinkage',
    componentProps: {
      saveCode: 'region',
    },
  },
  {
    label: '区域编码',
    field: 'areaCode',
    component: 'Input',
  },
  {
    label: '景区地址',
    field: 'attractionAddress',
    component: 'Input',
    slot: 'address',
  },
  {
    label: '经度',
    field: 'longitude',
    component: 'InputNumber',
  },
  {
    label: '纬度',
    field: 'latitude',
    component: 'InputNumber',
  },
  {
    label: '联系人名称',
    field: 'contactName',
    component: 'Input',
  },
  {
    label: '联系电话',
    field: 'contactPhone',
    component: 'Input',
  },
  {
    label: '官网网站',
    field: 'website',
    component: 'Input',
  },
  // TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];

// 高级查询数据
export const superQuerySchema = {
  attractionName: { title: '景点名称', order: 0, view: 'text', type: 'string' },
  attractionTheme: { title: '主题', order: 1, view: 'text', type: 'string' },
  attractionDescription: { title: '描述', order: 2, view: 'text', type: 'string' },
  attractionRecommendedDuration: { title: '建议游览时长（分钟）', order: 3, view: 'number', type: 'number' },
  attractionCapacity: { title: '最大承载量', order: 4, view: 'number', type: 'number' },
  isFeatured: { title: '热门景点 0否 1是', order: 5, view: 'number', type: 'number', dictCode: '' },
  attractionHeat: { title: '热度', order: 6, view: 'number', type: 'number' },
  attractionStatus: { title: '状态 0-开放 1-维修 2-临时关闭', order: 7, view: 'number', type: 'number', dictCode: '' },
  businessHour: { title: '营业时间', order: 8, view: 'text', type: 'string' },
  // attractionCountry: { title: '国', order: 9, view: 'text', type: 'string' },
  // attractionProvince: { title: '省份', order: 10, view: 'text', type: 'string' },
  // attractionCity: { title: '城市', order: 11, view: 'text', type: 'string' },
  // attractionDistrict: { title: '县/市/区', order: 12, view: 'pca', type: 'string' },
  // areaCode: { title: '区域编码', order: 13, view: 'text', type: 'string' },
  attractionAddress: { title: '景区地址', order: 14, view: 'text', type: 'string' },
  // longitude: { title: '经度', order: 15, view: 'number', type: 'number' },
  // latitude: { title: '纬度', order: 16, view: 'number', type: 'number' },
  contactName: { title: '联系人名称', order: 17, view: 'text', type: 'string' },
  contactPhone: { title: '联系电话', order: 18, view: 'text', type: 'string' },
  website: { title: '官网网站', order: 19, view: 'text', type: 'string' },
};

/**
 * 流程表单调用这个方法获取formSchema
 * @param param
 */
export function getBpmFormSchema(_formData): FormSchema[] {
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}
